This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Refactor and Stabilize Music Module - #2
Draft
google-labs-jules[bot] wants to merge 1 commit into
Draft
Conversation
This commit includes a full suite of fixes and improvements to the music module, addressing critical bugs, improving code quality, and enhancing stability. Key Bug Fixes: - Fixes a race condition in the `trackEnd` event that caused random song skipping by removing a redundant `player.play()` call. - Adds `trackStuck` and `trackError` event handlers to gracefully skip songs that fail to play, fixing issues where playback would stop mid-song. - Fixes the `/queue skipto` command to correctly modify the queue. - Fixes a validation conflict in the `/volume` command. - Fixes the `/loop` command to use the correct API method. - Fixes a race condition in the `/play` command by re-validating player state after an async search. Refactoring and Improvements: - Refactors duplicated `formatDuration` and `generateProgressBar` functions into a shared utility file. - Corrects the `/stop` command's behavior to no longer disconnect the bot. - Adds a guard against seeking in live streams. - Improves performance of the `/queue list` command for very large queues. - Removes a conflicting `queueEnd` event handler in favor of the configured `onEmptyQueue` option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit provides a comprehensive overhaul of the music module to fix numerous bugs and improve its overall stability, maintainability, and user experience.
The following critical bugs have been addressed:
autoSkipfeature and a manualplayer.play()call in thetrackEndevent handler was causing songs to be skipped. This has been resolved by removing the manual call.trackStuckandtrackErrorevents. The module now correctly handles these events by skipping to the next song./skipto,/loop, and/volumecommands had incorrect implementations that have now been fixed./play: A race condition that could cause a crash if/stopwas called during a song search has been resolved by re-validating the player state.In addition to bug fixes, the following improvements have been made:
/stopcommand now behaves more predictably (clearing the queue without disconnecting), and the/queue listcommand is now protected from performance issues with very large queues.queueEndhandler has been removed to make the bot's behavior more clear and reliant on its configuration.